package com.chixing.day03;

public class xiaxie {
    public static void main(String[] args) {
        int year = 2001;
        int month = 4;
        int day;

        if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
            day = 31;
        else if (month == 4 || month == 6 || month == 9 || month == 11)
            day = 30;
        else {
            if (year % 4 == 0 && year % 100 != 0)
                day = 29;
            else
                day = 28;
        }
        System.out.println(day);

        switch(month) {
            case 1:case 3:case 5:case 7:case 8:case 10:case 12: {
                day = 31;
                break;
            }
            case 4:case 6:case 9:case 11: {
                day = 30;
                break;
            }
            case 2: {
                if (year % 4 == 0 && year % 100 != 0)
                    day = 29;
                else
                    day = 28;
                break;
            }
            default:
                System.out.println("无效的月份");
                break;
        }

        int i=0;
        while (i<4){
            i++;
            System.out.print(i);
            System.out.print(i);
            System.out.print(i);
            System.out.print(i);
            System.out.println(i);
        }

        for (i=1;i<=4;i++){
            System.out.print(i);
            System.out.print(i);
            System.out.print(i);
            System.out.print(i);
            System.out.println(i);
        }
        i=0;
        int j=0;
        while (i<9&&j<9){
            i++;
            j++;
            System.out.print(i);
            System.out.print("x");
            System.out.print(j);
            System.out.print("=");
            System.out.println(i*j);
        }
        int a = 10;
        int b = 20;
        int c;
        if(a>b)
            c=a;
        else
            c=b;
        //三目运算
        c=a>b? a:b;//a>b,a赋值给c，b>a,b赋值给c
        System.out.println(c);

        for( i=1;i<=4;i++) {
            for ( j = 1; j <= 5; j++) {
                System.out.print(i);
            }
            System.out.println();
        }
        //for实现九九乘法表
        for (i=1;i<=9;i++){
            for (j=1;j<=i;j++){
                System.out.print(j+"*"+i+"="+(i*j)+" ");
            }
            System.out.println();
        }
        //while实现九九乘法表
        i=1;
        while(i<=9){
            j=1;

            while (j<=i){

                System.out.print(j+"*"+i+"="+(i*j)+" ");
                j++;
            }
            System.out.println();
            i++;
        }
        //找出一组数中的总和，平均值，最大值，最小值
        //栈：基本数据类型的变量名，值+引用数据类型的变量名
        //堆：引用数据类型的值
        int[]a1={48,62,63,826,73,48,12,66,19,30};
        int sum=0;
        i=0;
        while (i<a1.length){
            sum=sum+a1[i];
            i++;
        }
        System.out.println(sum);
        System.out.println((double)sum/a1.length);
        i=0;
        int min=a1[0];
        int max=a1[0];
        for ( i = 1; i < a1.length;i++) {
           if (a1[i]<min)
               min =a1[i];
            if (a1[i]>max)
                max =a1[i];
            }
        System.out.println(min+" "+max);














        }


    }



